<?php
/**
 * 全局设置
 */
namespace Admin\Controller;
use Think\Controller;
class GlobalController extends InitController {
   
	//显示设置页面
	public function setting() {

		$topmenu = $this->topmenu;
		$sidebarmenu = $this->sidebarmenu[I('get.k')];
		$res = M('PageSetting')->where('id = 1')->find();
		$this->assign(array(
			'topmenu'=>$topmenu,
			'sidebarmenu'=>$sidebarmenu,
			'res'=>$res,
		));

		$this->display('setting');

	}

	//保存设置
	public function SaveSetting(){
		if(!IS_AJAX){
			exit('ERROR');
		}

		$PcSetting = I('PcSetting');
		$data = array('pcsetting'=>$PcSetting);
		$num_rows = M('PageSetting')->where('id = 1')->save($data);
		if ( $num_rows > 0 ) {
			$this->ajaxReturn(array('error'=>0,'msg'=>'保存成功'));
		}else{
			$this->ajaxReturn(array('error'=>1,'msg'=>'ERROR'));
		}
	}
	
	
}